<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../../common/tags.jsp" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <%@include file="../../common/assets.jsp" %>
    <style type="text/css">
        .am-disabled {
            pointer-events : none;
        }
    </style>
</head>
<body>
<!-- header -->
<%@include file="../../common/header.jsp" %>

<!-- main start -->
<div class="am-cf admin-main">
    <!-- sidebar start -->
    <%@include file="../../common/menu.jsp" %>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">

        <div class="am-cf am-padding">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">系统配置</strong> /
                <small>后台操作日志管理</small>
            </div>
        </div>

        <div class="am-g">

            <div class="am-u-sm-12 am-u-md-6 am-text-left">&nbsp;</div>
            <div class="am-u-sm-12 am-u-md-6">
                <div class="am-form-group" style="float: right; width: 200px; margin-right: 5px;">
                    <div class="am-input-group am-input-group-sm">
                        <input type="text" class="am-form-field" id="searchKey" placeholder="请输入关键字">
                        <span class="am-input-group-btn">
								<button class="am-btn am-btn-default" type="button" onclick="searchOperationLog();">搜索</button>
							</span>
                    </div>
                </div>

                <div class="am-form-group" style="float: right; margin-right: 10px">
                    <select data-am-selected="{btnSize: 'sm',btnWidth:100}" id="selectOperationType">
                        <option value="" selected="selected">操作类型</option>
                        <option value="1">插入</option>
                        <option value="2">删除</option>
                        <option value="3">修改</option>
                    </select>
                </div>

            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table width="100%" class="am-table am-table-striped am-table-bordered am-table-compact" id="list_table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>SQL</th>
                                <th>参数</th>
                                <th>MAPPERID</th>
                                <th>类型</th>
                                <th>操作员</th>
                                <th>操作时间</th>
                                <th>备注</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </form>
                </div>

            </div>
        </div>
    </div>
    <!-- main end -->

    <!-- foot -->
    <%@include file="../../common/footer.jsp" %>

    <script type="text/javascript">
        var OPERATION_LOG_TABLE;

        $(function () {
            //表格初始化
            OPERATION_LOG_TABLE = initDataTable({
                ajax: '${webRoot}/configure/operationLog/list',
                /* responsive : false,
                 scrollX : true, */
                columns: ['id', 'sql', 'sqlParameter', 'sqlMapId', {
                    data: 'type',
                    render: function (v) {
                        return {
                            "1": "插入",
                            "2": "删除",
                            "3": "修改"
                        }[v]
                    }
                }, 'createAdministratorId', 'createTime', 'memo']
            }, function (data) { //搜索参数JSON数据
                return {
                    type: $('#selectOperationType').val(),
                    memo: $('#searchKey').val()
                };
            });
        });

        //搜索
        function searchOperationLog() {
            OPERATION_LOG_TABLE.draw();
        }

        //删除
        function deleteOperationLog(id) {
            layer.confirm('确定要删除登录历史：' + id + '?', {
                title: '删除确认'
            }, function (index) {
                ajaxRequest({
                    url: '${webRoot}/configure/operationLog/delete/' + id,
                    method: 'DELETE'
                }, function () {
                    searchOperationLog();
                });
            });
        }
    </script>
</body>
</html>